<template>
  <div>这是Home页面</div>
  <button @click="goToAbout">btn</button>
</template>

<script>
import { useRouter, useRoute } from "vue-router";
export default {
  setup() {
    // useRouter, useRoute这两个参数只能再setup的顶层调用
    // 代表路由实例，用于做编程式导航
    const router = useRouter();
    // 代表当前页面的路由信息，用于获取url相关的信息
    // const route = useRoute();

    const goToAbout = () => {
      // const router = useRouter();
      router.push("/about");
    };

    return {
      goToAbout,
    };
  },
};
</script>
